package io高级流or处理流;

import java.io.*;

public class CopyDemoBuffered {
    public static void main(String[] args) throws IOException {
        FileInputStream fil = new FileInputStream("./风景图.jpg");
        FileOutputStream fol = new FileOutputStream("./src/高级流or处理流/风景图98.jpg");
        BufferedInputStream bif = new BufferedInputStream(fil);
        BufferedOutputStream bof = new BufferedOutputStream(fol);
        /**缓冲流原码内部有一个8kb字节数组
         * 实际转换时已经是以块读写入，
         *
         * 缓冲流使用情况
         * */
        int b;
        while ((b=bif.read())!=-1){
            bof.write(b);
        }
        bif.close();
        bof.close();

//        FileInputStream fil = new FileInputStream("./风景图.jpg");
//        FileOutputStream fol = new FileOutputStream("./src/高级流or处理流/风景图4.jpg");
//        BufferedInputStream bf = new BufferedInputStream(fil);
//        BufferedOutputStream bof = new BufferedOutputStream(fol);
//        int a;//记录表字节
//        while ((a=bf.read())!=-1){
//            bof.write(a);
//        }
//        bf.close();
//        bof.close();
    }
}
